#include <bits/stdc++.h>
using namespace std;
#define FUCK
char GZ[][4]={{'A','T','C','G'},
            {'T','A','G','C'},
            {'C','G','A','T'},
            {'G','C','T','A'}};
unordered_map<char,int> G={{'A',0},{'T',1},{'C',2},{'G',3}};
string doo(string a,string b){
    int len=a.length();
    string s="";
    for(int i=0;i<len;i++){
        s+=GZ[G[a[i]]][G[b[i]]];
    }
    return s;
}
//暴力枚举
void method1(){
    int n,m;
    set<string> st;
    while(cin >> n >> m){
        st.clear();
        string t[n];
        for(int i=0;i<n;i++){
            cin >> t[i];
            st.insert(t[i]);
        }
        
        
        cout <<st.size() <<endl;
    }
}

int main(){
#ifdef FUCK
    freopen("in.txt","r",stdin);
    freopen("out.txt","w",stdout);
    int start=clock();
#endif
    method1();

#ifdef FUCK
    int end=clock();
    double p=(double)(end-start)/CLOCKS_PER_SEC;
    cout << "运行时间为 : "<<p*1000 <<" ms"<<endl;
#endif
    return 0;
}
